package com.bocai.kelalacar.ui.car.main.act;

import android.app.Activity;
import android.content.Intent;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bocai.kelalacar.R;
import com.bocai.kelalacar.base.BaseActivity;

import butterknife.BindView;

/**
 * Created by yuanfei on 2017/8/16.
 */

public class SplashActivity extends BaseActivity {

    @BindView(R.id.tv)
    TextView tv;

    @BindView(R.id.ll_main)
    LinearLayout llMain;

    @Override
    public int getLayoutId() {
        return R.layout.activity_splash;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        tv.setText("跳过3");
        llMain.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(SplashActivity.this, MainActivity.class));
                finish();
            }
        });
        CountDownTimer timer = new CountDownTimer(3000, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                Log.e("millisUntilFinished",millisUntilFinished+"");
                int index = (int) (millisUntilFinished/1000);
                Log.e("index",index+"");
                tv.setText("跳过"+index);
            }

            @Override
            public void onFinish() {
                tv.setText("跳过"+0);
                startActivity(new Intent(SplashActivity.this, MainActivity.class));
                finish();
            }
        };
        timer.start();
    }
}
